package com.zp.self.springboot.自动装配.ImportBeanDefinitionRegistrar接口;

import com.zp.self.springboot.自动装配.ImportSelector接口.MyImportSelector;
import com.zp.self.springboot.自动装配.Circle;
import com.zp.self.springboot.自动装配.ImportSelector接口.Person;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

@Import({Circle.class, MyImportSelector.class, MyImportBeanDefinitionRegistrar.class})
@Configuration
public class MyAutoConfig_2 {

    //测试
    public static void main(String[] args) {
        ApplicationContext context = new AnnotationConfigApplicationContext(MyAutoConfig_2.class);
        Circle circle = context.getBean(Circle.class);
        Person_2 Person_2 = context.getBean(Person_2.class);
        Person Person = context.getBean(Person.class);
        circle.sayHi();
        Person.sayHi();
        Person_2.sayHi();
    }
}

